package token

import (
	"starsine.cn/appTpl/cmn/logs"
)

var tokenMap *TokenMap = nil

func Start() {
	tokenMap = CreateTokenMap()

	logs.Infof("token start")
}

func CreateToken(svcID SvcID) TokenInfo {
	return tokenMap.CreateToken(svcID)
}

func RemoveToken(token string) {
	tokenMap.RemoveToken(token)
}

func RemoveTokenBySvcID(svcID SvcID) {
	tokenMap.RemoveTokenBySvcID(svcID)
}

func GetTokenInfo(svcID SvcID) (TokenInfo, bool) {
	return tokenMap.GetTokenInfo(svcID)
}

func GetSvcID(token string) (SvcID, bool) {
	return tokenMap.GetSvcID(token)
}

func Dump() (str string) {
	return tokenMap.Dump()
}
